10 ' 内盒打印程序
20 ' 泛海数据科技有限公司
30 ' 2019年4月

100 ' INIT
110 BREAK 0, 1 : '按F1键退出
120 BREAK 0 ON
130 ON BREAK 0 GOSUB HANDLECANCEL
140 ON ERROR GOTO HANDLEERR
140 OPEN "console:" AS 1
150 OPEN "uart1:" FOR INPUT AS 2
160 NASC 8
180 DIM PARTS$(8)
210 MARGINX% = 64
220 MARGINY% = 100
230 LINEHEIGHT% = 55
250 OPTIMIZE "BATCH" ON

900 PRINT "RUN LOOP"
910 PRINT #1: PRINT #1, "WAIT COM1"
920 IN$ = ""

1000 LOOP: LINE INPUT #2, IN$
1010 IF IN$="" THEN BEEP: GOTO LOOP
1020 IF IN$="END" THEN BEEP: GOTO EXIT

1100 C%=SPLIT(IN$,"PARTS$",64) :' @=64 AS separator
1110 IF C%<>8 THEN BEEP: GOTO LOOP
1120 CODE$=PARTS$(0)
1190 ITEM$ = MID$(CODE$,3,8)
1200 DESC1$ = PARTS$(1)
1210 DESC2$ = PARTS$(2)
1140 MPN$=PARTS$(3)
1150 CODE1$=PARTS$(4)
1160 LOTNO$=PARTS$(5)
1170 DATESTR$=PARTS$(6)
1180 MEMO$=PARTS$(7)

1980 ALIGN 7: DIR 4
1990 FONT "FangSong",8,0,100
2000 PRPOS MARGINX% + LINEHEIGHT% * 0, MARGINY%
2010 PRTXT "编码ITEM:     " + ITEM$
2020 PRPOS MARGINX% + LINEHEIGHT% * 1, MARGINY%
2030 PRTXT "序列号SN:"
2040 PRPOS MARGINX% + LINEHEIGHT% * 1, MARGINY% + 280
2050 BARSET "CODE128",2,1,3,96
2060 BARFONT "Univers",6,0,5,1,1,100 ON
2070 PRBAR CODE$
2080 PRPOS MARGINX% + LINEHEIGHT% * 4, MARGINY%
2090 PRTXT "描述DESC: " + DESC1$
2100 PRPOS MARGINX% + LINEHEIGHT% * 5, MARGINY% + 40
2110 PRTXT DESC2$
2120 PRPOS MARGINX% + LINEHEIGHT% * 6, MARGINY%
2130 PRTXT "供应商型号MPN: " + MPN$
2140 PRPOS MARGINX% + LINEHEIGHT% * 7, MARGINY%
2150 PRTXT "原产地CO: CHINA"
2160 PRPOS MARGINX% + LINEHEIGHT% * 8, MARGINY%
2170 PRTXT "数量QTY: 1PCS"
2180 PRPOS MARGINX% + LINEHEIGHT% * 9, MARGINY%
2190 PRTXT "代码CODE: " + CODE1$
2200 PRPOS MARGINX% + LINEHEIGHT% * 10, MARGINY%
2210 PRTXT "批次号LOT NO: " + LOTNO$
2220 PRPOS MARGINX% + LINEHEIGHT% * 11, MARGINY%
2230 PRTXT "日期: " + DATESTR$
2240 PRPOS MARGINX% + LINEHEIGHT% * 12, MARGINY%
2250 PRTXT "备注: " + MEMO$
2260 PRPOS MARGINX% + LINEHEIGHT% * 9, MARGINY% + 640
2270 PRIMAGE "CE200H.BMP"

2280 PRINTFEED
3000 GOTO LOOP

10000 EXIT: ' EXIT
10010 CLOSE 1
10020 CLOSE 2
10030 PRINT "END"
10040 END

15000 HANDLEERR: BEEP: BEEP: BEEP : BEEP: BEEP: BEEP
15010 PRINT "ERROR", ERL, ERR
15020 GOTO EXIT

20000 HANDLECANCEL: ' CANCELED
20010 GOTO EXIT